package com.flash.mapper;

import com.flash.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     *通过dishId获得套餐id
     * @param dishIds
     * @return
     */
    List<Long>getSetMealIdsByDishIds(List<Long> dishIds);

    /**
     * 插入dishID
     * @param setmealDishes
     */
    void insertSetMealDishes(List<SetmealDish> setmealDishes);

    /**
     *通过单独的dishId获取到setmeal
     * @param id
     * @return
     */
    @Select("select * from flash_delivery.setmeal_dish where setmeal_id = #{id} ")
    List<SetmealDish> getDishesIById(Long id);

    /**
     * 根据setmealId删除记录
     * @param id
     */
    @Delete("delete from flash_delivery.setmeal_dish where id = #{id} ")
    void deleteByDishId(Long id);

    void deleteBysetMealId(List<Long> ids);


}
